// pages/history/index.js
const SERVER = require('../../utils/index');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isActive:0,
    activeList:['我拍中的','我参拍的'],
    list:[],
  },
  changeIndex(e){
    const index = e.currentTarget.dataset.index
    console.log(index)
    var that=this
    
    wx.request({//首页数据
      url: '' + SERVER.SERVER_DIMAIN + '/customer/follow/historyauction', 
      data: {
        current:'0',
        size:'100',
        type:index
      },
      header: {
        'content-type': 'application/json' ,
        "TENANT-ID":"2",
        "Connection":'Keep-alive',
        "Accept-Encoding":'gzip,deflate,br',
        "Authorization":"Bearer "+wx.getStorageSync('token'),
        "DEVICE_TYPE":'IOS'
      },
      method: 'get',
      success: function (res) {
        console.log(res)
        that.setData({
          list:res.data.data.records
        })
        
        // that.setData({
        //   list:res.data.data
        // })
        
     
       
      }
    });
    this.setData({isActive:index})
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const index = options.index
    console.log(index)
    if(index == 1){
      this.setData({
        isActive:1
      })
    }
    var that=this
    
    wx.request({//首页数据
      url: '' + SERVER.SERVER_DIMAIN + '/customer/follow/historyauction', 
      data: {
        current:'0',
        size:'100',
        type:'0'
      },
      header: {
        'content-type': 'application/json' ,
        "TENANT-ID":"2",
        "Connection":'Keep-alive',
        "Accept-Encoding":'gzip,deflate,br',
        "Authorization":"Bearer "+wx.getStorageSync('token'),
        "DEVICE_TYPE":'IOS'
      },
      method: 'get',
      success: function (res) {
        console.log(res)
        that.setData({
          list:res.data.data.records
        })
        
        // that.setData({
        //   list:res.data.data
        // })
        
     
       
      }
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})